<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<div class="navbar navbar-fixed-top">
	<div class="navbar-inner">
		<div style="text-align: right; position: relative">
			<s:url var="signOutUrl" action="signOut" namespace="/" />
			<s:a href="%{#signOutUrl}" title="%{#session.SESSION_USER.username}">
				<s:text name="global.user.signout" />
			</s:a>
			|
			<s:include value="/WEB-INF/content/common/date-time.jsp" />
			<span id="datetime">&nbsp;&nbsp;</span>
		</div>
		<div class="container-fluid">
			<a href="#" class="btn btn-navbar" data-toggle="collapse"
				data-target=".nav-collapse"> <span class="icon-th-list"></span>
			</a> <a href="#" class="brand"> <s:text
					name="global.application.title" />
			</a>
			
			<div class="nav-collapse collapse">
				<div class="row-fluid">
					<ul class="nav">
						<li class="dropdown"><s:a href="#" class="dropdown-toggle"
								data-toggle="dropdown">
								<s:text name="master.usermenu" />
								<b class="caret"></b>
							</s:a>
							<ul class="dropdown-menu">
								<li><s:url action="view" namespace="/selectClient"
										var="selectUrl" /> <s:a href="%{#selectUrl}">
										<s:text name="master.usermenu.userselection" />
									</s:a></li>
							</ul></li>

						<li class="dropdown"><s:a href="#" class="dropdown-toggle"
								data-toggle="dropdown">
								<s:text name="master.recordmenu" />
								<b class="caret"></b>
							</s:a>
							<ul class="dropdown-menu">
								<s:iterator var="counter" begin="0" end="17" status="rowIndex">
									<li class="checkselectclient"><s:url action="menuview"
											namespace="/input" var="inputUrl">
											<s:param name="refid" value='#rowIndex.index' />
										</s:url> <s:a href="%{#inputUrl}">
											<s:property
												value="getText('master.recordmenu.' + #rowIndex.index)" />
										</s:a></li>
									<s:if
										test="%{#rowIndex.index == 0 || #rowIndex.index == 1 || #rowIndex.index == 7 
												|| #rowIndex.index == 8 || #rowIndex.index == 9 || #rowIndex.index == 11 
												|| #rowIndex.index == 12 || #rowIndex.index == 13 || #rowIndex.index == 14 
												|| #rowIndex.index == 15 || #rowIndex.index == 16}">
										<li class="divider" />
									</s:if>
								</s:iterator>
							</ul></li>

						<li class="dropdown"><s:a href="#" class="dropdown-toggle"
								data-toggle="dropdown">
								<s:text name="master.endmenu" />
								<b class="caret"></b>
							</s:a>

							<ul class="dropdown-menu">
								<li><a href="#"> <s:text name="master.endmenu" />
								</a></li>

								<li class="divider" />

								<li><s:url action="signOut" namespace="/" var="signOutUrl" />
									<s:a href="%{#signOutUrl}">
										<s:text name="master.endmenu.signout" />
									</s:a></li>
							</ul></li>
							
							<li class="dropdown checkselectclient">
							<s:url action="viewVital" namespace="/input" var="newvitalUrl" />
							
							<s:a href="%{#newvitalUrl}" >
								<s:text name="master.vitaldata" />
							</s:a>
							
							</li>
					</ul>
				</div>
			</div>
			<div class="row-fluid">
					<div class="container-fluid offset2">
						<div class="input-append input-prepend">
							<s:form class="form-inline" style="margin-bottom:0px;" action="searchClient" namespace="/selectClient">
								<button class="btn btn-custom" type="submit" name="isBtnClick" value='true'>
									<s:text name="master.usermenu.userselection" />
									</button>
								<input type="text" id="txtSearchClient" name="searchClient.userName" class="span6" value='<s:property value="%{#session.CURRENT_PATIENT.userName}"/>'>
								<span class="add-on" style="-webkit-border-radius: 0 4px 4px 0;-moz-border-radius: 0 4px 4px 0;border-radius: 0 4px 4px 0;">
								<s:text name="master.MrMrs" /></span>						
							</s:form>						
						</div>
	
						<div class="input-append input-prepend" id="impldateformdiv">
							<s:form style="margin-bottom:0px;" action="saveimpldate" namespace="/home">							
								<span class="add-on"><s:text name="master.implementation.date" /></span>
								<input type="text" id="datepicker" name="implDate" style="cursor: pointer;background-color: #ffffff;">
								<button class="btn btn-custom" onclick="setToday()"
									style="-webkit-border-radius: 0 4px 4px 0;-moz-border-radius: 0 4px 4px 0;border-radius: 0 4px 4px 0;" type="button">
									<s:text name="titlehead.settoday" /></button>
							</s:form>
							<s:hidden name="prevDateHidden" id="prevDate" />
							
						</div>
					
						<div class="pull-right input-prepend input-append">							
							<s:url action="view" namespace="/home" var="homeUrl" />
							<s:a href="%{#homeUrl}" class = "btn btn-custom">
								<span class="add-on btn btn-custom"><i class="icon-home icon-white"></i></span> 
								<span class="add-on btn btn-custom"><s:text name="global.return.home" /></span>
							</s:a>
						</div>
					</div>
				</div>
		</div>
	</div>
</div>

<script type="text/javascript">

	$(document).ready(function() {
		$('.checkselectclient').click(function(e) {
			checkSelectClient(e);
		});

		var frm = $('#impldateformdiv').find('form');		
		var prevdate = $('#datepicker').val();
		$("input[id=prevDate]").val(prevdate);
		
	 	$('#datepicker').change(function () {
	 	
		 	var prevValue = $('#prevDate').val();
		 	var newValue = $('#datepicker').val();
		 	
		 	if(newValue.length && prevValue != newValue){		 	
		 		$("input[id=prevDate]").val(newValue);		 		
		 		$.ajax({
					type : frm.attr('method'),
					url : frm.attr('action'),
					data : frm.serialize(),
					async : false,
					success : function(response) {
					},
					error : function(err) {
					 alert("ImplementationDate Error :" + err);
					}
				});
			}
	 	});

	});    
	
	function setToday(){	
		var date = new Date();	
		$("#datepicker").scroller('setDate', date, true, 0);	
	}

	$(function() {
		var date = { preset : 'date', maxDate : new Date() };

		$("#datepicker").show();
		$('#datepicker').val('').scroller('destroy')
				.scroller($.extend(date, {
					theme : 'sense-ui',
					mode : 'mixed',
					display : 'bubble',
					lang : 'ja'
				}));

		$('#datepicker').trigger('change');
		$('#datepicker').val('<s:property value="%{#session.IMPLEMENTATION_DATE.jaDate}"/>');

	});

	(function($) {
		$.mobiscroll.i18n.ja = $.extend($.mobiscroll.i18n.ja,
			{
				// Core
				setText : 'セット',
				cancelText : 'キャンセル',
				// Datetime component
				dateFormat : 'yy年mm月dd日DD',
				dateOrder : 'yymmdd',
				dayNames : [ '日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日' ],
				dayNamesShort : [ '日', '月', '火', '水', '木', '金', '土' ],
				dayText : '日',
				hourText : '時',
				minuteText : '分',
				monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月' ],
				monthNamesShort : [ '1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月',	'10月', '11月', '12月' ],
				monthText : '月',
				secText : '秒',
				timeFormat : 'HH:ii',
				timeWheels : 'HHii',
				yearText : '年',
				nowText : '今',
				// Calendar component
				dateText : '日付',
				timeText : '時間',
				calendarText : 'カレンダー',
				// Measurement components
				wholeText : '全数',
				fractionText : '分数',
				unitText : '単位',
				// Time / Timespan component
				labels : [ '年間', '月間', '日間', '時間', '分', '秒', '' ],
				labelsShort : [ '年間', '月間', '日間', '時間', '分', '秒', '' ],
				// Timer component
				startText : '開始',
				stopText : '停止',
				resetText : 'リセット',
				lapText : 'ラップ',
				hideText : '隠す'
			});
	})(jQuery);
</script>